package com.codi.admin.controller;

import com.codi.base.domain.BaseResult;
import com.codi.base.exception.BaseAppException;
import com.codi.bus.core.domain.ext.UserExt;
import com.codi.bus.core.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @DESCRIBE
 * @Author sungaoxiang [sungaoxiang@cd121.com]
 * @DATE 2017/10/11 10:51
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping(value = "all", method = RequestMethod.GET)
    public BaseResult getUserList(@RequestParam(value = "pageIndex", defaultValue = "1") Integer pageIndex,
                                  @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
                                  UserExt user) throws BaseAppException {
        return BaseResult.success(userService.queryList(pageIndex, pageSize,user));
    }

    @RequestMapping(value = "count", method = RequestMethod.GET)
    public BaseResult getBulletinCount( UserExt user) throws BaseAppException {
        return BaseResult.success(userService.queryListCount(user));
    }
}
